<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="./css/login.css">
    <link rel="stylesheet" href="./css/reset.css">
    <script src="./js/jquery.js"></script>
    <script src="./js/layer/layer.js"></script>
</head>

<body>
    <header>
        <div class="he-t">
            <div class="he-tLe">
                <a href=""><img src="./images/logo.gif" alt=""></a>
            </div>
            <p>
                <span>|</span>
                <span>欢迎登录</span>
            </p>
        </div>      
    </header>

    <section>
        <div class="log conter">
            <div class="dl">
                <p class="zh">账户登录</p>
                <div class="input">
                    <div class="in-t">
                        <form action="">
                            <p style="height: 16px;padding:5px 0"></p>
                            <p class="yhm">
                                <span class="yhm-l">
                                </span>
                                <input name="useName" type="text" placeholder="用户名">
                            </p>

                            <p class="mm">
                                <span style="background-position: -48px 0" class="yhm-2">
                                </span>
                                <input type="password" placeholder="密码" name="usePwd">
                            </p>

                            <p class="bc">
                                <input type="checkbox">请保存我这次登录信息
                                <a href="">忘记密码</a>
                            </p>

                            <p class="dl">
                                <input type="submit" value="登录">
                            </p>
                            
                        </form>
                        <div class="zc">
                            <a href="./zc.html">立即注册</a>
                        </div>
                    </div>
                </div>
            </div>

            
        </div>
    </section>
    <footer>
        <div class="foo-fl">
            <p>浙ICP备14001577号-1</p>
            <p>© 2005-2019 跨境淘 版权所有，并保留所有权利</p>
        </div>
    </footer>
</body>
<script>
    $(function(){
        $("form").on("submit",function(e){
            $.ajax({
                url:"./../server/login.php",
                data:$("form").serialize(),
                type:'post',
                dataType:"json"
            }).then(function(res){
                var showIcom=res.status==1?1:-3;
                layer.confirm(res.msg,
                {
                    icon:showIcom,
                    title:"登录提示",
                    btn:['确定','取消']
                },function(){
                    if(res.status==1){
                        location="./index1.html";
                    }else{
                        location="./loginhtml"
                    }
                   

                    localStorage.setItem("use",JSON.stringify(res.data));         
                    }, function (index) {
                        layer.close(index);
                });
            })

            return false;
        })
    })
</script>
</html>